import { createRouter, createWebHashHistory } from 'vue-router';

const routes = [
  { path: '/', redirect: '/login' },

  {
    path: '/nav',
    redirect: '/nav/home',
    component: () => import('@/views/navigation/index.vue'),
    meta: {
      keepAlive: true,
    },
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('../views/home/index.vue'),
        meta: {
          keepAlive: true,
        },
      },
      {
        path: 'personal',
        name: 'personal',
        component: () => import('../views/personal/index.vue'),
        meta: {
          keepAlive: false,
        },
      },
      {
        path: 'roomDetails',
        name: 'roomDetails',
        component: () => import('@/views/home/roomDetails/index.vue'),
        meta: {
          keepAlive: false,
          tabbar: false,
        },
      },
    ],
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/login.vue'),
    meta: {
      keepAlive: false,
    },
  },
  {
    path: '/publishRoom',
    name: 'publishRoom',
    component: () => import('@/views/houseManagement/publishRoom/index.vue'),
    meta: {
      keepAlive: false,
    },
  },
  {
    path: '/modifyRoomInfo',
    name: 'modifyRoomInfo',
    component: () => import('@/views/houseManagement/modifyRoomInfo/index.vue'),
    meta: {
      keepAlive: false,
    },
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
